<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <video class="video" width="500" height="500" src="./Ipad Mini/large_a.webm" controls></video>
</body>


<script>
    let video = document.querySelector(".video")
    let setIn;
    let framsNumber = 0;



    function createFrame(video,videoWidth,videoHeight) {
        const canvas = document.createElement("canvas");

        const context = canvas.getContext("2d");

        canvas.width = videoWidth;
        canvas.height = videoHeight;
        context.drawImage(video,0,0,videoWidth,videoHeight);

        return canvas;
    }



    video.play()

    video.addEventListener("canplaythrough",(res) => {
        console.log(res);
        // clearInterval(setIn);

        setIn = setInterval(() => {
            console.log("动画执行中-----");
            if (framsNumber >= frameCount) clearInterval(setIn);

            framsStore[framsNumber] = createFrame(video,videoWidth,videoHeight);
            framsNumber++;
        },30);
    });
</script>


</html>